<template>
  <div id="app">
    <div class="line">
      <div class="item">
        <div class="label">中文</div>
        <input type="text" v-model="cnText" @blur="cnToEn(cnText)">
      </div>
      <div class="item">
        <div class="label">英文</div>
        <input type="text" v-model="enText">
      </div>
    </div>
  </div>
</template>

<script>
//引入方法
import ChineseHelper from '@/libs/ChineseHelper.js'
export default {
  name: 'App',
  components: {
    
  },
  data () {
    return {
      cnText:'',
      enText:''
    }
  },
  methods: {
    /**
     * 失去焦点进行转换
     */
    cnToEn(cn){
      this.enText = ChineseHelper.ConvertPinyin(cn)
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
